Can a neural network modify its own weights?
One important step in training a neural network is called backpropagation. In the course of this process, the weights of the neural network are updated into a direction that minimizes the training loss. Usually, this step happens after each batch (with batch gradient descent) or after each sample (with stochastic gradient descent).
In other words, training a neural network does not mean anything else than iteratively updating its weights. However, note that the weights are not updated by the neural network itself, but by the optimizer and the machine learning framework you use.
Can a neural network modify its architecture?
Currently, there is no popular solution of a neural network which is able to change its own structure. However, there has been a lot of research in this area at least since the 90s. The search-term with which you will find most research in this area is self-organizing networks. Some of the first self-organizing networks were from Fritzke (1994) and from Bruske and Sommer (1994).
However, these were not neural networks that learned how to optimize themselves but neural networks that had the ability to grow while following certain rules. And that has a reason. If you think about it, you want your network to be optimized in solving a certain problem (e.g. detecting breast cancer on X-ray images) as good as possible. You do not want it to waste time and resources on learning how to optimize neural networks.
But there are other approaches in this direction! There is a lot of research on how to train a neural network on the task of creating other neural networks. Currently, the most famous are MetaQNN (2017) (less known) and NASNet (2017). They use reinforcement learning to train a model on creating architectures that maximize the performance (e.g. validation accuracy). However, even as they use reinforcement learning, they perform only slightly better than random search (see here). That means the question is more how you define the search space than whether you use neural networks for architecture optimization.