Layer weights don't match in keras
Expected shape of parameter arrays
Each layer has two arrays:

one for the weights, which has a shape of (num_inputs, num_outpus)
one for the biases, which has a shape of (num_outputs)

Here the num_inputs is the number of input features to that layer and the num_outputs is the number of outputs from that layer (this is what you select when instantiating a layer).
Output of .get_weights()
Another important thing to note is the usage of .get_weights(). In fact there are to ways to use it:

From the model, i.e. model.get_weights(): This will return a flattened list containing all parameter arrays in order. For example, it could look like this: [layer1_weights, layer1_biases, layer2_weights, layer2_biases, ...]

From a layer, i.e. layer.get_weights(): This is what you used. Here it will return the parameter arrays for a given layer. For example model.layers[1].get_weights() will return the parameter arrays for layer1. If layer1 has biases then this will return two arrays, one for the weights and one for the biases.



I took the liberty of changing your code a bit to make this a bit more clear.
import numpy as np
import tensorflow as tf

f = lambda x: 2*x

Xtrain = np.random.rand(400, 5)  # 5 input features
ytrain = f(Xtrain)
Xval = np.random.rand(200, 5)  # 5 input features
yval = f(Xval)

model = tf.keras.models.Sequential([
    tf.keras.layers.Dense(10, activation='relu'),  # this layer has 5 inputs and 10 outputs
    tf.keras.layers.Dense(1, activation='relu')  # this layer has 10 inputs and 1 output
])

model.compile(optimizer='adam',
              loss=tf.keras.losses.MeanSquaredError()
             )

model.fit(Xtrain, ytrain, epochs=1, verbose=0)

# I will be calling .get_weights() directly from the model,
# so we expect 4 arrays: 2 for each layer.
 
print('First layer weights:', model.get_weights()[0].shape)
print('First layer biases:', model.get_weights()[1].shape)
print('Second layer weights:', model.get_weights()[2].shape)
print('Second layer biases:', model.get_weights()[3].shape)

The output:
First layer weights: (5, 10)  
First layer biases: (10,)  
Second layer weights: (10, 1)  
Second layer biases: (1,)